package plus.lgx.textsearcher.entity;

import java.io.File;

/**
 * Class name: FileWrapper
 *
 * Create time: 12/17/22 3:42 PM
 *
 * @author lgx
 * @version 1.0
 */
public class FileWrapper {

    /**
     * 包含有匹配的字符串的文件数量，在此可作为文件编号
     */
    public final int fileNumber;

    /**
     * 该文件目前在所有文件的所在编号
     */
    public final int totalFileNumber;

    /**
     * 匹配字符串的数量
     */
    private int matchedNumber = 0;

    public int addAndGetMatchedNumber() {
        return ++matchedNumber;
    }

    public final File file;

    public FileWrapper(File file, int fileNumber, int totalFileNumber) {
        this.file = file;
        this.fileNumber = fileNumber;
        this.totalFileNumber = totalFileNumber;
    }

    public boolean hasMatched() {
        return matchedNumber > 0;
    }

    public int getMatchedNumber() {
        return matchedNumber;
    }
}
